package com.remoter.basic.consumer;

import java.io.Closeable;
import java.util.List;

import com.remoter.basic.bean.support.ConsumerModule;
import com.remoter.basic.bean.support.ProviderModule;
import com.remoter.basic.bean.support.RemoterRequest;
import com.remoter.basic.transport.IClient;
import com.remoter.basic.util.ServiceLoader.SPI;

/**
 * @author			koko
 * @date 			2017-08-10 14:29:09
 * @description 	类功能说明
 */
@SPI
public interface IConsumer extends Closeable{
	
	public void attachConsumer(ConsumerModule consumerModule);
	public void detachConsumer(ConsumerModule consumerModule);
	public ConsumerModule getConsumer(RemoterRequest remoterRequest);
	
	public IClient getClient(ConsumerModule consumerModule,boolean autoConnect)throws Exception;
	
	/**
	 * 返回注册中心成功注册所有provider,包含其他服务器提供的服务
	 * @param consumerModule
	 * @return
	 */
	public List<ProviderModule> getProviders(ConsumerModule consumerModule);
	
	public <T> T getConsumerProxy(Class<T> type, ConsumerModule consumerModule);
	
}